<div id="last_trade"></div>
<script id="temp_last_trade" type="text/html">
    <div class="tradehistory">
        <div class="history-title">
            <p><i class="fa fa-list-ul green"></i> <%=tdata.title%> </p>
        </div>
        <table class="table table-striped">
            <colgroup style="width:40%"></colgroup>
            <colgroup style="width:30%"></colgroup>
            <colgroup style="width:40%"></colgroup>
            <tbody>
            <tr>
                <th class="f-left gray-b"><%=tdata.price%>(<%=coin1_info.name_upper%>)</th>
                <th class="f-right gray-b"><%=tdata.num%>(<%=coin0_info.name_upper%>)</th>
                <th class="f-right gray-b"><%=tdata.times%></th>
            </tr>
            </tbody>
        </table>
        <div class="item-con">
            <div class="scrollStyle">
                <table class="table table-hover table-striped" ng-hide="!trades.length">
                    <colgroup style="width:30%"></colgroup>
                    <colgroup style="width:30%"></colgroup>
                    <colgroup style="width:40%"></colgroup>
                    <tbody>
                    <% cnt = 0 %>
                    <% var last_price = 0 %>
                    <% var last_color = "green" %>
                    <% jsonobj = jsonobj.reverse() %>
                    <% for(i = 0; i < jsonobj.length; i ++ ){ %>
                    <% var info = jsonobj[i] %>
                    <% cnt += info.count %>
                    <% var price = (info.price *1).toFixed(4)%>
                    <% var class_color = "magenta"%>
                    <% if (last_price > price) { %>
                    <% class_color="green"; %>
                    <% } else if (last_price < price) { %>
                    <% class_color="magenta"; %>
                    <% } else { %>
                    <% class_color=last_color; %>
                    <% } %>
                    <% last_price = price %>
                    <% last_color = class_color %>
                    <% jsonobj[i].class_color = class_color %>
                    <% } %>

                    <% jsonobj = jsonobj.reverse() %>
                    <% var av = 4 * cnt / jsonobj.length %>
                    <% for(i = 0; i < jsonobj.length; i ++ ){ %>
                    <% var info = jsonobj[i] %>
                    <% var count = (info.count * 1).toFixed(4) %>
                    <% var wd = count/av *100 %>
                    <% var wd = wd <= 100 ? wd:100 %>
                    <% var price = (info.price *1).toFixed(4)%>
                    <% var finish_time = $imports.data_format_time(info.finish_time); %>
                    <% var class_color = info.class_color; %>
                    <tr onclick="on_all_order_click(this)">
                        <td class="f-left <%=class_color%>">
                            <div class="price"><%=price%></div>
                        </td>
                        <td class="f-right"><%=count%></td>
                        <td class="f-right"><%=finish_time%></td>
                    </tr>
                    <%}%>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</script>
